<template>
	<view class='center'>
		<u-navbar title="全部圈子" @rightClick="rightClick" :autoBack="true" style="margin-bottom: 100rpx;">
		</u-navbar>
		<view class='center-list'>
			<view class="pics">
				<scroll-view class="gundong" scroll-y v-for="(item,index) in navData" :key="index">
					<view :class="{'active':isActive === index}" @click="checked(index)">
						{{item.category.name}}
					</view>
				</scroll-view>
			</view>
			<view class="message">
				<text>2</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				isActive: 0,
				navData: Object,
			}
		},
		onLoad() {
			uni.request({
				url: "v2/all_category_forums?date=2023-10-12&mode=3&is_my_category=1",
				success: (res) => {
					this.navData = res.data.data.categories
					console.log(res.data.data.categories);
				}
			})
		},
		methods: {
			checked(index) {
				this.isActive = index
			},
			rightClick() {
				uni.navigateBack()
			}
		}
	}
</script>

<style>
	page {
		height: 100%;
	}

	.center {
		width: 100%;
		height: 100%;
		position: relative;
	}

	.center-list {
		width: 200rpx;
		height: 100%;
		position: fixed;
		overflow: auto;
	}

	.pics {
		width: 100%;
		height: auto;
	}

	.gundong {
		width: 200rpx;
		height: 100rpx;
	}

	.gundong view {
		height: 100rpx;
		line-height: 100rpx;
		text-align: center;
		/*  background-color: #f1f1f1; */
		font-size: 28rpx;
		color: #666;
	}

	.active {
		color: #333;
		font-weight: 700;
		border-left: 8rpx solid #ff5934;
	}

	.message {
		position: fixed;
		left: 200rpx;
		top: 0;
		background-color: var(--bgcolor);
		width: 100%;
		min-height: 100vh;
		padding: 18rpx;
	}
</style>